<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <link rel="icon" type="image/svg+xml" href="/vite.svg"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Vite + Vue</title>
</head>
<body>
    <div id="app"></div>
<!--<h1>浏览器自动拉起input23</h1>-->
<!--<input type="text" id="inputEl" contenteditable="true" autofocus>-->
<script>
    // let inputEl=document.querySelector('#inputEl')
    // console.log('inputEl==',inputEl)
    // setTimeout(()=>{
    //     inputEl.focus()
    //     console.log('执行快乐')
    // },4000)
    //  function testA() {
    //      await 'abc'
    //     //     new Promise((resolve,reject)=>{
    //     //     resolve('abc')
    //     //     console.log('111')
    //     //     console.log('333');
    //     // })
    //     console.log('testResult==',testResult)
    //     return testResult
    // }
    // testA();
    console.log('2222');
    // 红绿灯等待
    function red(timer) {
        console.log('red-',timer);
    }

    function green(timer) {
        console.log('green-',timer);
    }

    function yellow(timer) {
        console.log('yellow-',timer);
    }

    var light = function(timer, cb) {
        return new Promise(function(resolve, reject) {
            setTimeout(function() {
                cb(timer);
                resolve();
            }, timer);
        });
    };

    var step = function() {
        Promise.resolve().then(function() {
            return light(3000, red);
        }).then(function() {
            return light(2000, green);
        }).then(function() {
            return light(1000, yellow);
        }).then(function() {
            step();
        });
    }
    // step();


</script>

<script type="module" src="./src/main.js"></script>
</body>
</html>
